<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templates/template_admin.xhtml">
        <ui:define name="content">
            <f:view>
                <h:form>
                    <h1><h:outputText value="List Employee"/></h1>
                    <h:outputLabel value="#{emb.message}"/>
                    <p:dataTable id="dataTable" value="#{emb.employeeList()}" var="e" paginator="true" rows="5"  
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="3,5,10,15">
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="EmployeeID"/>
                            </f:facet>
                            <h:outputText value="#{e.employeeID}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="FullName"/>
                            </f:facet>
                            <h:outputText value="#{e.firstName} #{e.lastName}"/>
                        </p:column>                        
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Gender"/>
                            </f:facet>
                            <h:selectOneMenu id="gender"
                                             value="#{e.gender}"
                                             styleClass="text-input medium-input" disabled="true">
                                <f:selectItem itemLabel="Male" itemValue="#{true}"/>
                                <f:selectItem itemLabel="Female" itemValue="#{false}" />
                            </h:selectOneMenu>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Dob"/>
                            </f:facet>
                            <h:outputText value="#{e.dob}">
                                <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                            </h:outputText>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="PhoneNumber"/>
                            </f:facet>
                            <h:outputText value="#{e.phoneNumber}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Email"/>
                            </f:facet>
                            <h:outputText value="#{e.email}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Address"/>
                            </f:facet>
                            <h:outputText value="#{e.address}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Position"/>
                            </f:facet>
                            <h:outputText value="#{e.position}"/>
                        </p:column>                       
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="DepartmentID"/>
                            </f:facet>
                            <h:outputText value="#{e.departmentID.name}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Action"/>
                            </f:facet>
                            <h:commandLink value="View" action="#{emb.emView(e)}"/><br/>
                            <h:commandLink value="Edit" action="#{emb.emEdit(e)}"/><br/>
                            <h:commandLink value="Delete" action="#{emb.deleteemployee(e)}" onclick="return confirm('Are you sure delete not?')"/><br/>
                        </p:column>
                    </p:dataTable>
                    <p:commandButton action="Create" value="New Create"/>
                </h:form>
            </f:view>

        </ui:define>
    </ui:composition>

</html>
